<?php
////App::import('Vendor','xtcpdf'); 
////$tcpdf = new XTCPDF();
////$textfont = 'freesans';

////$tcpdf->SetAuthor("");
////$tcpdf->SetAutoPageBreak( false );
////$tcpdf->setHeaderFont(array($textfont,'',10));
////$tcpdf->xheadercolor = array(255,255,255);
////$tcpdf->xheadertext = 'Fecha: '. date('d-m-Y',time());
////$tcpdf->xfootertext = 'www.pedroventura.com';

// Ahora imprimimos el contenido de la pagina en una posición determinada
// estos datos son un ejemplo, y en mi ejemplo hay un pequeño texto y una imagen.
////$tcpdf->AddPage();
////$tcpdf->SetTextColor(0, 0, 0);
////$tcpdf->SetFont($textfont,'B',10);
////$tcpdf->Cell(10,20,'Nombre:', 0, 0);
// configuramos la calidad de JPEG
////$tcpdf->setJPEGQuality(100);
////$tcpdf->Image($imagen, 0, 50, 200, 200, '', '', '', false, 150);  

// se pueden asignar mas datos, ver la documentación de TCPDF

////echo $tcpdf->Output('mi_archivo.pdf', 'D'); //el pdf se muestra en el navegador
//echo $tcpdf->Output('mi_archivo.pdf', 'D'); //el pdf se descarga

?>
<?php 
App::import('Vendor','tcpdf/tcpdf');  
ob_clean();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 
       PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 
                    PDF_HEADER_TITLE.' 001', 
                    PDF_HEADER_STRING, array(0,64,255), 
                    array(0,64,128));
$pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 
                    PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', 
                    PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, 
                 PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);

// Add a page
// This method has several options, check the source code 
// documentation for more information.
$pdf->AddPage();

// set text shadow effect
$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 
                    'depth_h'=>0.2, 'color'=>array(196,196,
                    196), 'opacity'=>1, 'blend_mode'=>
                    'Normal'));

$html = '<h1>HTML Example</h1>
Some special characters: &lt; ? &euro; &#8364; &amp; è 
&egrave; &copy; &gt; \\slash \\\\double-slash \\\\\\triple-
slash
<h2>List</h2>
List example:
<ol>
    
    <li><b>bold text</b></li>
    <li><i>italic text</i></li>
    <li><u>underlined text</u></li>
    <li><b>b<i>bi<u>biu</u>bi</i>b</b></li>
    <li><a href="http://www.tecnick.com" dir="ltr">link to 
                http://www.tecnick.com</a></li>
    <li>Sed ut perspiciatis unde omnis iste natus error sit 
    voluptatem accusantium doloremque laudantium, totam rem 
    aperiam, eaque ipsa quae ab illo inventore veritatis et 
    quasi architecto beatae vitae dicta sunt explicabo.<br />
    Nemo enim ipsam voluptatem quia voluptas sit aspernatur 
    aut odit aut fugit, sed quia consequuntur magni dolores 
    eos qui ratione voluptatem sequi nesciunt.</li>
    <li>SUBLIST
        <ol>
            <li>row one
                <ul>
                    <li>sublist</li>
                </ul>
            </li>
            <li>row two</li>
        </ol>
    </li>
    <li><b>T</b>E<i>S</i><u>T</u> <del>line through</del><
     /li>
     <li><font size="+3">font + 3</font></li>
     <li><small>small text</small> normal <small>small text<
     /small> normal <sub>subscript</sub> normal <sup>
     superscript</sup> normal</li>
 </ol>
 <dl>
     <dt>Coffee</dt>
     <dd>Black hot drink</dd>
     <dt>Milk</dt>
     <dd>White cold drink</dd>
 </dl>
 <div style="text-align:center">IMAGES<br />
 
 </div>';
 
 // output the HTML content
 $pdf->writeHTML($html, true, false, true, false, '');
 
 // ---------------------------------------------------------
 
 // Close and output PDF document
 // This method has several options, check the source code 
// documentation for more information.
 $pdf->Output('example_001.pdf', 'I');
 exit;
 //===========================================================
    
 // END OF FILE
 //===========================================================
    
 ?>
